<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use dosamigos\datepicker\DatePicker;
use dosamigos\datepicker\DateRangePicker;
/* @var $this yii\web\View */
/* @var $model app\models\WmActiveSearch */
/* @var $form yii\widgets\ActiveForm */
$times = date("Y-m-d");
$BeginDate=date('Y-m-01', strtotime(date("Y-m-d")));
$WmActiveSearchData = Yii::$app->request->get('WmActiveSearch');
$fromdate = !empty($WmActiveSearchData['fromdate'])?$WmActiveSearchData['fromdate']:$BeginDate;

$todate = !empty($WmActiveSearchData['todate'])?$WmActiveSearchData['todate']:$times;
?>

<div class="wm-active-search">

    <?php $form = ActiveForm::begin([
        'options'=>['class'=>'form-inline'],
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field($model, 'pid')->label(false)->hiddenInput() ?>


    <?= DateRangePicker::widget([
        'name' => 'WmActiveSearch[fromdate]',
        'value' => $fromdate,
        'language'=>'zh-CN',
        'labelTo'=>'至',
        'containerOptions' => ['class' => 'ff'],
        'nameTo' => 'WmActiveSearch[todate]',
        'valueTo' => $todate,
        'clientOptions' => [
            'autoclose' => true,
            'format' => 'yyyy-m-dd'
        ]
    ]);?>


    <div class="form-group">
        <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
